package com.zlsy.thread.threadlocal;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zhouliang
 * @date 2020/07/11
 **/
public class ThreadLocalNormalUsage01 {

    public String date(int seconds) {
        Date date = new Date(1000 * seconds);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return simpleDateFormat.format(date);
    }

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 30; i++) {
            int finalI = i;
            Thread thread = new Thread(
                    new Runnable() {
                        @Override
                        public void run() {
                            String date = new ThreadLocalNormalUsage01().date(finalI);
                            System.out.println(date);
                        }
                    }
            );
            thread.start();

            Thread.sleep(100);
        }
    }
}
